<?php $this->beginWidget('webroot.widgets.iButtonBar');?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>UserModule::t('Create Profile Field'),
    'type'=>'success',
    'icon'=>'plus-sign white',
    'url'=> array('create')
));?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>UserModule::t('Advanced Search'),
    'type'=>'primary',
    'icon'=>'plus-sign white',
    'url'=> '#',
	'htmlOptions'=>array('class'=>'search-button')
));?>
<?php $this->endWidget();?>
<?php
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
    $('.search-form').toggle();
    return false;
});
$('.search-form form').submit(function(){
    $.fn.yiiGridView.update('profile-field-grid', {
        data: $(this).serialize()
    });
    return false;
});
");

?>

<div class="search-form" style="display:none">
<?php $this->beginWidget('webroot.widgets.iPortlet', array('title'=>UserModule::t('Advanced Search')));?>
<?php $this->renderPartial('_search',array(
    'model'=>$model,
)); ?>
<?php $this->endWidget();?>
</div><!-- search-form -->

<?php $this->widget('webroot.widgets.iGridView', array(
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		array(
			'name'=>'id',
			'htmlOptions'	=>	array('width'=>'50'),
		),
		array(
			'name'=>'varname',
			'type'=>'raw',
			'value'=>'UHtml::markSearch($data,"varname")',
		),
		array(
			'name'=>'title',
			'value'=>'UserModule::t($data->title)',
		),
		array(
			'name'=>'field_type',
			'value'=>'$data->field_type',
			'filter'=>ProfileField::itemAlias("field_type"),
		),
		'field_size',
		//'field_size_min',
		array(
			'name'=>'required',
			'value'=>'ProfileField::itemAlias("required",$data->required)',
			'filter'=>ProfileField::itemAlias("required"),
		),
		//'match',
		//'range',
		//'error_message',
		//'other_validator',
		//'default',
		'position',
		array(
			'name'=>'visible',
			'value'=>'ProfileField::itemAlias("visible",$data->visible)',
			'filter'=>ProfileField::itemAlias("visible"),
		),
		//*/
		array(
			'class'=>'webroot.widgets.iButtonColumn',
			'htmlOptions'=>array('style'=>'width: 50px'),
		),
	),
)); ?>
